#include <iostream>
class Complex
{
    friend Complex operator+(const Complex &c1, const Complex &c2);
    friend std::ostream &operator<<(std::ostream &os, const Complex &c);
    friend std::istream &operator<<(std::istream &is, Complex &c);

public:
    Complex(int real = 0, int vir = 0) : real(real), vir(vir)
    {
    }
    // Complex operator+(const Complex &c)
    // {
    //     Complex c1;
    //     c1.real = this->real + c.real;
    //     c1.vir = this->vir + c.vir;
    //     return c1;
    // }
    /*前置*/
    Complex operator++()
    {
        real++;
        vir++;
        return *this;
    }
    /*后置*/
    Complex operator++(int)
    {
        Complex tmp = *this;
        tmp.real++;
        tmp.vir++;
        return tmp;
    }

private:
    int real;
    int vir;
};
Complex operator+(const Complex &c1, const Complex &c2)
{
    Complex ret(c1.real + c2.real, c1.vir + c2.vir);
    return ret;
}
std::ostream &operator<<(std::ostream &os, const Complex &c)
{

    if (c.vir != 0)
    {
        os << c.real << "+" << c.vir << "i" << std::endl;
    }
    else
    {
        os << c.real << std::endl;
    }
    return os;
}
std::istream &operator<<(std::istream &is, Complex &c)
{
    is >> c.real >> c.vir;
    return is;
}
int main()
{
    Complex c(2, 3);
    Complex c1(1, 2);
    // Complex c2 = ++c1;
    std::cout << c1;
    std::cout << c1++;
    std::cout << c1;
    std::cout << ++c1;
    // std::cout << ++c1;
    // Complex c2(0, 0);
    // std::cin << c2;n

    // Complex c2 = c + c1;
    // c2.operator<<(std::cout);
    // c2 << std::cout;
    // operator<<(std::cout, c2);
    // std::cout << c2;
    // c2.show();
}